<?php defined('InShopNC') or exit('Access Invalid!');?>

<div class="page">
  <!-- 页面导航 -->
  <div class="fixed-bar">
    <div class="item-title">
      <div class="subject">
        <h3>客户介绍返利统计</h3>
        <h5>客户介绍返回查看与管理</h5>
      </div>
      <ul class="tab-base nc-row">
        <li><a href="/admin/modules/shop/index.php?act=fencheng_rebate" class="current">返利统计</a></li>
        <li><a href="/admin/modules/shop/index.php?act=fencheng_rebate&op=kanjia_list" >线下合同补录</a></li>
        <li><a href="/admin/modules/shop/index.php?act=fencheng_rebate&op=kanjia_setting" >返利设置</a></li>
        <li><a href="/admin/modules/shop/index.php?act=fencheng_rebate&op=rebate_doing" >活动规则</a></li>
      </ul>
    </div>
  </div>

  <!-- 操作说明 -->
  <div class="explanation" id="explanation">
    <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
      <h4 title=""></h4>
      <span id="explanationZoom" title=""></span> </div>
    <ul>
      <li>列表为各猎人状态及返利记录</li>
      <li>当店铺状态为"等待审核"时才可以编辑申请,否则只能查看详情</li>
    </ul>
  </div>

  <div id="flexigrid"></div>

    <div class="ncap-search-ban-s" id="searchBarOpen"><i class="fa fa-search-plus"></i>高级搜索</div>
    <div class="ncap-search-bar">
      <div class="handle-btn" id="searchBarClose"><i class="fa fa-search-minus"></i>收起边栏</div>
      <div class="title">
        <h3>高级搜索</h3>
      </div>
      <form method="get" name="formSearch" id="formSearch">
        <input type="hidden" name="advanced" value="1" />
        <div id="searchCon" class="content">
          <div class="layout-box">
            <dl>
              <dt>活动名称</dt>
              <dd>
                <input type="text" name="kanjia_name" class="s-input-txt" placeholder="请输入活动名称关键字" />
              </dd>
            </dl>
            <dl>
              <dt>店铺名称</dt>
              <dd>
                <input type="text" name="store_name" class="s-input-txt" placeholder="请输入店铺名称关键字" />
              </dd>
            </dl>
            <dl>
              <dt>活动时期筛选</dt>
              <dd>
                <label>
                    <input type="text" name="pdate1" data-dp="1" class="s-input-txt" placeholder="结束时间不晚于" />
                </label>
                <label>
                    <input type="text" name="pdate2" data-dp="1" class="s-input-txt" placeholder="开始时间不早于" />
                </label>
              </dd>
            </dl>

          </div>
        </div>
        <div class="bottom">
          <a href="javascript:void(0);" id="ncsubmit" class="ncap-btn ncap-btn-green">提交查询</a>
          <a href="javascript:void(0);" id="ncreset" class="ncap-btn ncap-btn-orange" title="撤销查询结果，还原列表项所有内容"><i class="fa fa-retweet"></i><?php echo $lang['nc_cancel_search'];?></a>
        </div>
      </form>
    </div>

</div>

<script>
$(function(){
    var flexUrl = 'index.php?act=fencheng_rebate&op=rebate_list_xml';

    $("#flexigrid").flexigrid({
        url: flexUrl,
        colModel: [
            {display: '操作', name: 'operation', width: 150, sortable: false, align: 'center', className: 'handle'},
            {display: '猎人账号(账号/昵称)', name: 'hunter_name', width: 150, sortable: false, align: 'left'},
            {display: '手机号码', name: 'phone', width: 150, sortable: false, align: 'left'},
            {display: '对象数量(注册/购买/无效)', name: 'num', width: 150, sortable: false, align: 'center'},
            {display: '累计贡献成功金', name: 'total', width: 100, sortable: false, align: 'center'},
            {display: '累计返现金', name: 'withdraw', width: 80, sortable: false, align: 'center'},
            {display: '待出账金额', name: 'freeze_money', width: 80, sortable: false, align: 'center'},
            {display: '状态', name: 'state', width: 80, sortable: false, align: 'center'},
            {display: '注册/最后登录时间', name: 'time', width: 250, sortable: false, align: 'center'},
        ],
        searchitems: [
            {display: '活动名称', name: 'kanjia_name', isdefault: true},
            {display: '店铺名称', name: 'store_name'}
        ],
        sortname: "kanjia_id",
        sortorder: "desc",
        title: '砍价活动列表'
    });

    // 高级搜索提交
    $('#ncsubmit').click(function(){
        $("#flexigrid").flexOptions({url: flexUrl + '&' + $("#formSearch").serialize(),query:'',qtype:''}).flexReload();
    });

    // 高级搜索重置
    $('#ncreset').click(function(){
        $("#flexigrid").flexOptions({url: flexUrl}).flexReload();
        $("#formSearch")[0].reset();
    });

    $('[data-dp]').datepicker({dateFormat: 'yy-mm-dd'});

});

$('a[data-href]').live('click', function() {
    if ($(this).hasClass('confirm-on-click') && !confirm('确定"'+$(this).text()+'"?')) {
        return false;
    }

    $.getJSON($(this).attr('data-href'), function(d) {
        if (d && d.result) {
            $("#flexigrid").flexReload();
        } else {
            alert(d && d.message || '操作失败！');
        }
    });
});

</script>
